package com.boot.lxf;

import com.boot.lxf.service.UserConsumerQueryService;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;

import javax.annotation.PostConstruct;

@SpringBootApplication
public class DubboApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext config = SpringApplication.run(DubboApplication.class, args);
        UserConsumerQueryService userDubboService = config.getBean(UserConsumerQueryService.class);
        userDubboService.getuser();
    }

    @PostConstruct
    public void postUser() {
        System.out.println("11111111111");
    }

    @Bean
    public CommandLineRunner commandLineRunner() {
        return new HelloWorldCommandLineRunner();
    }

    public static class HelloWorldCommandLineRunner implements CommandLineRunner {
        public void run(String... strings) throws Exception {
            System.out.println("Hello World!");
        }
    }
}
